/*
 * Created on Wed Dec 29 11:14:04 CET 2010
 */

/* 
 * This Bundle subscribes to service who expose alerts
 * It displays them
 */

package org.ece.meteo.showalerte;

import java.util.*;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.event.EventConstants; 
import org.osgi.service.event.EventHandler;

public class Activator implements BundleActivator {
	
	/**
	 * Implements Activator.start(). Prints that it is starting and
	 * exports a new service through ShowalerteImpl().
	 * @param context the framework context for the bundle.
	**/	  
    public void start(BundleContext context) throws Exception {  
    	
        String[] topics = new String[] {
                "org/ece/meteo/alerte/*"
            };
            
            Dictionary props = new Hashtable();
            props.put(EventConstants.EVENT_TOPIC, topics);
            // register the service to the FW
            context.registerService(EventHandler.class.getName(), new ShowalerteImpl() , props);
        	System.out.println("> org.ece.meteo.showalerte started");	
    	
    }  

	/**
	 * Implements Activator.stop(). Prints that it is stopping
	 * @param context the framework context for the bundle.
	**/   
    public void stop(BundleContext bundleContext) throws Exception {  
    	  // all is done by the Framework
    	System.out.println("> org.ece.meteo.showalerte resolved");	
    }  
      
}
